Import('RTT_ROOT')
Import('rtconfig')
from building import *

cwd = GetCurrentDir()

CPPPATH = [cwd + '/include', cwd + '/contrib']

src = Glob('jtag/*.cpp')
src += Glob('target/*.cpp')
src += Glob('adapter/*.cpp')
src += Glob('helper/*.c')

if GetDepend('MOPENOCD_ADAPTER_RTTGPIO_ENABLE'):
    src += Glob('contrib/adapter/rttBbGPIO.cpp')
    src += Glob('contrib/adapter/rttJtagGPIO.cpp')

if GetDepend('MOPENOCD_TARGET_RISCV_ENABLE'):
    src += Glob('target/riscv/*.cpp')
    src += Glob('target/riscv/rv11/*.cpp')

group = DefineGroup('mOpenOCD', src, depend = ['PKG_USING_MOPENOCD'], CPPPATH = CPPPATH)

Return('group')
